<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>axios异步通信</title>
    <style>
        <!--
        解决异步闪烁问题-- >
        [v-clock] {
            display: none;
        }
    </style>
</head>
<body>
<div id="vue" v-clock>
    <div>{{info.name}}</div>
    <div>{{info.address.street}}</div>
    <div>{{info.address.city}}</div>
    <div>{{info.links[1]}}</div>

    <a v-bind:href="info.url">点我跳转百度</a>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>Vue.config.productionTip = false </script>
<script type="text/javascript">
    var app = new Vue({
        el: "#vue",
        data() {
            return {
                info: {
                    name: null,
                    address: {
                        country: null,
                        city: null,
                        street: null
                    },
                    url: null
                }
            }
        },
        mounted() { // 钩子函数：执行过程中插入执行,链式
            axios
                .get('../data.json')
                .then(response => (this.info = response.data));
        }
    });

</script>
</body>
</html>
